import request from '@/utils/request'
// import axios from 'axios'
import { apiVersion } from '@/config'
// import { getDeviceId } from '@/utils/tool'


// 用户信息
export function usersInfo(data) {
    return request({
        url: `/serv-user/api/${apiVersion}/users/info`,
        method: 'get',
        data
    })
}

// 二次登陆（切换用的）
export function changeOrgAuthToken(data) {
    let params = ''
    for (let i in data) {
        params += `${i}=${data[i]}&`
    }
    return request({
        url: `/serv-auth/oauth/token?${params}`,
        method: 'post',
        data
    })
}
// 验证码
export function verificationCode(data) {
    return request({
        url: `/auth/${apiVersion}/verification/code`,
        method: 'get',
        data
    })
}
// 登录
export function login(data) {
    let params = ''
    for (let i in data) {
        params += `${i}=${data[i]}&`
    }
    return request({
        url: `/auth/${apiVersion}/oauth/token?${params}`,
        method: 'post',
        data
    })
}

